//
//  RandomForest.h
//  RandomForest-AndreaBalboni
//
//  Created by Andrea Balboni on 07/04/12.
//  Copyright (c) 2012 Università degli Studi di Modena e Reggio Emilia. All rights reserved.
//

#ifndef RandomForest_AndreaBalboni_RandomForest_h
#define RandomForest_AndreaBalboni_RandomForest_h


#include "RandomTree.h"
#include <map>


template <typename _T> class RandomForest {
    
private:
	unsigned int _forestSize;
	
	TrainingData<_T> _trainingData;
    
	std::vector<RandomTree<_T> > _randomTrees;
    
public:
	RandomForest();
	~RandomForest();
    
    //Crea la foresta di alberi leggendo ogni volta il dataset da file
	void createForest(std::string trainingDataPath, unsigned int numTrees, unsigned int depth, unsigned int method);
    
    //Crea la foresta di alberi leggendo ogni volta il dataset da file
	void createForest(std::string trainingDataPath, unsigned int numTrees, unsigned int method);
    
    //Crea la foresta di alberi utilizzando una reference a un dataset precaricato
    void createForest(TrainingData<_T> &trainingData, unsigned int numTrees, unsigned int depth, unsigned int method, bool bagging, unsigned int numRecords=500);
	
    //Crea la foresta di alberi utilizzando una reference a un dataset precaricato
    void createForest(TrainingData<_T> &trainingData, unsigned int numTrees, unsigned int method, bool bagging, unsigned int numRecords=500);
    //Classificazione della foresta
    unsigned int classify(MyRecord<_T> &record);
    unsigned int classifyFisher(cv::Mat_<double> &record);
    
};


#endif
